﻿status = -1;
var itemList = Array(
5000018,5000221,5000191,5000382,5000345,5000017,5000368,5000274,5000095,5000094,5000096,5000324,5000284,5000285,5000206,5000215,5000225,5000216,5000264,5000267,5000081,5000433,5000434,5000435,5000415,5000416,5000417,5000402,5000403,5000404,5000342,5000343,5000344,5000330,5000331,5000332,5000271,5000272,5000273,5000320,5000321,5000322,5000249,5000250,5000251,5000203,5000204,5000205,5000093,5000092,5000091,5000287,5000288,5000289,5000228,5000229,5000230,5000237,5000243,5000244,5000245,5000247,5000252,5000290,5000292,5000291,5000293,5000294,5000295,5000296,5000297,5000298,5000370,5000369,5000371,5000352,5000353,5000354,5000375,5000376,5000377,5000366,5000367,5000365
);

function start() {
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == 1) {
        status++;
    } else {
       if (mode == 0 && status == 0) {
			im.dispose();
			return;
		}
        status--;
    }
    if (status == 0) {
        var text = "";
		for(var i=0; i<itemList.length; i++) {
			text+="#L"+i+"##v"+itemList[i]+"##z"+itemList[i]+"##l\r\n";
		}
		im.sendSimple("请选择你要换取的宠物自选箱子：\r\n#r"+text);
    } else if(status == 1) {
		var itemid = itemList[selection];
		var itemnum = Math.floor(Math.random()*1+1);
		var item = im.gainPetGachaponItem(itemid, itemnum, "宠物自选箱子", 3);
		im.gainItem(2430046, -1);
		im.sendOk("恭喜您，获得了"+itemnum+"个#b#z"+itemid+"#");
		im.safeDispose();
	}
}
